package member;

import com.opensymphony.xwork2.ActionSupport;
import com.ibatis.common.resources.Resources;
import com.ibatis.sqlmap.client.SqlMapClient;
import com.ibatis.sqlmap.client.SqlMapClientBuilder;

import java.io.IOException;
import java.io.Reader;
import java.util.Date;

@SuppressWarnings("serial")
public class memberJoinAction extends ActionSupport{
	public static Reader reader;
	public static SqlMapClient sqlMapper;
	
	private memberVO paramClass;
	private memberVO resultClass;
	
	private String empcd;
	private String groupcd;
	private String rank;
	private String emp_name;
	private String emp_name_kana;
	private Date emp_valid_start_date;
	private Date emp_valid_end_date;
	private String editorcd;
	private Date update_date;
	private Date update_time;
	private String resignflag;
	private String user_type;
	private String smcd;
	private String password;
	
	public memberJoinAction () throws IOException{
		reader = Resources.getResourceAsReader("sqlMapConfig.xml");
		sqlMapper = SqlMapClientBuilder.buildSqlMapClient(reader);
		reader.close();
	}
	
	public String form() throws Exception{
		return SUCCESS;		
	}
	
	public String execute() throws Exception{
		
		paramClass = new memberVO();
		resultClass = new memberVO();
		
		paramClass.setEmpcd(getEmpcd());
		paramClass.setGroupcd(getGroupcd());
		paramClass.setRank(getRank());
		paramClass.setEmp_name(getEmp_name());
		paramClass.setEmp_name_kana(getEmp_name_kana());
		paramClass.setEmp_valid_start_date(getEmp_valid_start_date());
		paramClass.setEmp_valid_end_date(getEmp_valid_end_date());
		paramClass.setEditorcd(getEditorcd());
		paramClass.setUpdate_date(getUpdate_date());
		paramClass.setUpdate_time(getUpdate_time());
		paramClass.setResignflag(getResignflag());
		paramClass.setUser_type(getUser_type());
		paramClass.setSmcd(getSmcd());
		paramClass.setPassword(getPassword());
		
		sqlMapper.insert("insertSMember", paramClass);
		
		return SUCCESS;
		
	}

	public static Reader getReader() {
		return reader;
	}

	public static void setReader(Reader reader) {
		memberJoinAction.reader = reader;
	}

	public static SqlMapClient getSqlMapper() {
		return sqlMapper;
	}

	public static void setSqlMapper(SqlMapClient sqlMapper) {
		memberJoinAction.sqlMapper = sqlMapper;
	}

	public memberVO getParamClass() {
		return paramClass;
	}

	public void setParamClass(memberVO paramClass) {
		this.paramClass = paramClass;
	}

	public memberVO getResultClass() {
		return resultClass;
	}

	public void setResultClass(memberVO resultClass) {
		this.resultClass = resultClass;
	}

	public String getEmpcd() {
		return empcd;
	}

	public void setEmpcd(String empcd) {
		this.empcd = empcd;
	}

	public String getGroupcd() {
		return groupcd;
	}

	public void setGroupcd(String groupcd) {
		this.groupcd = groupcd;
	}

	public String getRank() {
		return rank;
	}

	public void setRank(String rank) {
		this.rank = rank;
	}

	public String getEmp_name() {
		return emp_name;
	}

	public void setEmp_name(String emp_name) {
		this.emp_name = emp_name;
	}

	public String getEmp_name_kana() {
		return emp_name_kana;
	}

	public void setEmp_name_kana(String emp_name_kana) {
		this.emp_name_kana = emp_name_kana;
	}

	public Date getEmp_valid_start_date() {
		return emp_valid_start_date;
	}

	public void setEmp_valid_start_date(Date emp_valid_start_date) {
		this.emp_valid_start_date = emp_valid_start_date;
	}

	public Date getEmp_valid_end_date() {
		return emp_valid_end_date;
	}

	public void setEmp_valid_end_date(Date emp_valid_end_date) {
		this.emp_valid_end_date = emp_valid_end_date;
	}

	public String getEditorcd() {
		return editorcd;
	}

	public void setEditorcd(String editorcd) {
		this.editorcd = editorcd;
	}

	public Date getUpdate_date() {
		return update_date;
	}

	public void setUpdate_date(Date update_date) {
		this.update_date = update_date;
	}

	public Date getUpdate_time() {
		return update_time;
	}

	public void setUpdate_time(Date update_time) {
		this.update_time = update_time;
	}

	public String getResignflag() {
		return resignflag;
	}

	public void setResignflag(String resignflag) {
		this.resignflag = resignflag;
	}

	public String getUser_type() {
		return user_type;
	}

	public void setUser_type(String user_type) {
		this.user_type = user_type;
	}

	public String getSmcd() {
		return smcd;
	}

	public void setSmcd(String smcd) {
		this.smcd = smcd;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

}
